package com.wlw.layoutmanager.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;

import com.wlw.layoutmanager.R;
import com.wlw.layoutmanager.adapters.BannerAdapter;
import com.wlw.layoutmanager.layoutManager.BannerLayoutManager;

import java.util.ArrayList;
import java.util.List;

public class BannerActivity extends AppCompatActivity {
    private RecyclerView recyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_banner);
        recyclerView = findViewById(R.id.recyclerView);
        BannerLayoutManager bannerLayoutManager = new BannerLayoutManager(this, recyclerView, 4, OrientationHelper.VERTICAL);
        bannerLayoutManager.setTimeSmooth(400f);
        recyclerView.setLayoutManager(bannerLayoutManager);
       recyclerView.setAdapter(new BannerAdapter(getData()));
    }

    private List<String> getData() {
       String[] mTitles = {
                "小米8官方宣布有双路GPS,小米8、小米8SE发售时间曝光",
                "这样的锤子你玩懂了吗?坚果R1带来不一样的体验",
                "三星真的很爱酸苹果!新广告讽刺苹果手机电池降速事件",
                "双摄全面屏 游戏长续航 魅族科技发布魅蓝6T售799元起",
        };
        List<String>data=new ArrayList<>();
        for (int i = 0; i < 50; i++) {
            data.add(mTitles[i%4]);
        }
        return data;
    }
}
